const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpackdevserver = require('webpack-dev-server')
// 配置webpack的配置文件，需要配置的对象导出，给webpack使用
module.exports = {
  // 1、入口: entry,从哪个文件开始打包
  entry: './src/mian.js',
  output: {
    path: path.resolve(__dirname, './dist'),
    filename: 'index.js',
  },
  module: {
    rules: [
      { test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader'] },
      { test: /\.css$/, use: ['style-loader', 'css-loader'] },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './dist/index.html',
    }),
    // new webpackdevserver(),
  ],
  // DevServer: {},
  // 模式 mode development未压缩的，production压缩的
  mode: 'development',
}
